import { FC, useState, useEffect } from 'react';
import { Divider, Space, Table, Button, message, Spin, Pagination } from 'antd';
import './correctingDetail.less';
import { endorFneEndorDetaiApi } from '@src/apis/invoiceApis';
import { useLocation } from 'react-router-dom';
import { getUrlParams } from '@src/utils';
export const CorrectingDetail: FC = () => {
  useEffect(() => {
    console.log('默认进来查询页面');
    getPageInfo();
    return () => {};
  }, []);
  const [loading, setLoading] = useState<boolean>(false);
  const [pageData, setPageData] = useState<any>({
    subPolicyDetail: { riskInfoDTOList: [{}], clauseKindDTOList: [] },
    proposalDetail: {},
  });
  const localtions: any = useLocation();
  const searchObj: any = getUrlParams(localtions.search);
  console.log(searchObj);
  const getPageInfo = () => {
    setLoading(true);
    endorFneEndorDetaiApi({
      fneOrderNo: searchObj.fneOrderNo,
    })
      .then((result: any) => {
        setLoading(false);
        setPageData(result.data);
      })
      .catch((err: any) => {
        console.log(err);
        setLoading(false);
      });
  };
  return (
    <Spin spinning={loading} delay={100}>
      <div className="pageBox pad20 fff policyDetail">
        <div className="publicH1Box">
          <h1>批改信息</h1>
          <div className="itemBox">
            <div className="item">
              <div>
                <div className="name">批改订单号:</div>
                <div className="value">{pageData.channelEndorOrder}</div>
              </div>
              <div>
                <div className="name">批改类型:</div>
                <div className="value">{pageData.correctType === '01' ? '已批改' : '未批改'}</div>
              </div>
              <div>
                <div className="name">批改申请时间:</div>
                <div className="value">{pageData.createTime}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">批单号:</div>
                <div className="value">{pageData.fneOrderNo}</div>
              </div>
            </div>
          </div>
        </div>
        <div className="publicH1Box margT20">
          <h1>投保订单信息</h1>
          <div className="itemBox">
            <div className="item">
              <div>
                <div className="name">投保订单号:</div>
                <div className="value">{pageData.proposalDetail.proposalOrder}</div>
              </div>
              <div>
                <div className="name">投保订单创建时间:</div>
                <div className="value">{pageData.proposalDetail.proposalCreateTime}</div>
              </div>
              <div>
                <div className="name">业务类型:</div>
                <div className="value">{pageData.proposalDetail.productItemType}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">出单子账号:</div>
                <div className="value">{pageData.subPolicyDetail.makeCode}</div>
              </div>
              <div>
                <div className="name">原始保费:</div>
                <div className="value">{pageData.subPolicyDetail.premium}</div>
              </div>
              <div>
                <div className="name">当前保费:</div>
                <div className="value">{pageData.subPolicyDetail.curAmount}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">保额:</div>
                <div className="value">{pageData.subPolicyDetail.amount}</div>
              </div>
            </div>
          </div>
        </div>
        <div className="publicH1Box margT20">
          <h1>订单信息</h1>
          <div className="itemBox">
            <div className="item">
              <div>
                <div className="name">订单号:</div>
                <div className="value">{pageData.subPolicyDetail.orderNo}</div>
              </div>
              <div>
                <div className="name">订单创建时间:</div>
                <div className="value">{pageData.subPolicyDetail.businessDate}</div>
              </div>
              <div>
                <div className="name">出单状态:</div>
                <div className="value">{pageData.subPolicyDetail.policyStatusFraDictName}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">退保状态:</div>
                <div className="value">{pageData.subPolicyDetail.surrenderStatusFraDictName}</div>
              </div>
              <div>
                <div className="name">投保人类型:</div>
                <div className="value">{pageData.subPolicyDetail.appliTypeFraDictName}</div>
              </div>
              <div>
                <div className="name">投保人名称:</div>
                <div className="value">{pageData.subPolicyDetail.appliName}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">投保人证件类型:</div>
                <div className="value">{pageData.subPolicyDetail.appliIdentifyTypeFraDictName}</div>
              </div>
              <div>
                <div className="name">投保人证件号码:</div>
                <div className="value">{pageData.subPolicyDetail.appliIdentifyNumber}</div>
              </div>
              <div>
                <div className="name">被保人类型:</div>
                <div className="value">{pageData.subPolicyDetail.insuredTypeFraDictName}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">被保人名称:</div>
                <div className="value">{pageData.subPolicyDetail.insuredName}</div>
              </div>
              <div>
                <div className="name">被保人证件类型:</div>
                <div className="value">
                  {pageData.subPolicyDetail.insuredIdentifyTypeFraDictName}
                </div>
              </div>
              <div>
                <div className="name">被保人证件号码:</div>
                <div className="value">{pageData.subPolicyDetail.insuredIdentifyNumber}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">保险起期:</div>
                <div className="value">{pageData.subPolicyDetail.startDate}</div>
              </div>
              <div>
                <div className="name">保险止期:</div>
                <div className="value">{pageData.subPolicyDetail.endDate}</div>
              </div>
              <div>
                <div className="name">原始保费:</div>
                <div className="value">{pageData.subPolicyDetail.premium}</div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">当前保费:</div>
                <div className="value">{pageData.subPolicyDetail.curAmount}</div>
              </div>
              <div>
                <div className="name">保额:</div>
                <div className="value">{pageData.subPolicyDetail.amount}</div>
              </div>
              <div>
                <div className="name">预计赔付金额:</div>
                <div className="value">
                  {pageData.subPolicyDetail.riskInfoDTOList[0].estimateIndemnityMoney}
                </div>
              </div>
            </div>
            <div className="item">
              <div>
                <div className="name">保单号:</div>
                <div className="value">{pageData.subPolicyDetail.policyNo}</div>
              </div>
              <div></div>
              <div></div>
            </div>
          </div>
        </div>
      </div>
    </Spin>
  );
};
